﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;

namespace Acme.BookStore.Storage
{
    public class ApprovalHistoryService : ApplicationService, IApprovalHistoryService
    {
        private readonly IRepository<ApprovalHistory, Guid> _historyRepository;

        public ApprovalHistoryService(IRepository<ApprovalHistory, Guid> historyRepository)
        {
            _historyRepository = historyRepository;
        }

        public async Task AddHistoryAsync(Guid inboundManageId, string operationType, string result, string comment, string operatorName)
        {
            var history = new ApprovalHistory
            {
                InboundManageId = inboundManageId,
                OperationType = operationType,
                ApprovalResult = result,
                ApprovalComment = comment,
                OperatorName = operatorName
            };
            await _historyRepository.InsertAsync(history);
        }
    }
}
